export interface Marker {
  latitude: number;
  longitude: number;
  id?: number;
  width: string | number;
  height: string | number;
  iconPath?: string;
  clusterId?: number;
  zIndex?: number
  /** 标注的透明度 默认 1，无透明，范围 0 ~ 1 */
  alpha?: number
  label?: MarkerLabel;
  joinCluster?: boolean;
  /** {x, y}，x 表示横向(0-1)，y 表示竖向(0-1)。{x: .5, y: 1} 表示底边中点 */
  anchor?: {
    x: number
    y: number
  }
}

export interface MarkerLabel {
  content?: string;
  color?: string;
  fontSize?: number;
  textAlign?: 'left' | 'right' | 'center';
  anchorX?: number | string;
  anchorY?: number | string;
  borderWidth?: number;
  borderColor?: string;
  borderRadius?: number;
  bgColor?: string;
  padding?: number;
  width?: string | number;
  height?: string | number;
}

export interface RegionchangeResult {
  type: 'begin' | 'end';
  causedBy?: 'drag' | 'scale' | 'update' | 'gesture';
  detail?: {
    centerLocation?: {
      latitude: number;
      longitude: number;
    };
    rotate?: number;
    scale?: number;
    skew?: number;
  };

  /** 兼容小程序2.3.0 及以下 ============= start*/
  /** 是否是手势触发 */
  gesture: boolean;
  centerLocation?: {
    latitude: number;
    longitude: number;
  };
  rotate?: number;
  scale?: number;
  skew?: number;
  /** 兼容小程序2.3.0 及以下 ============= end*/
}

export interface ClustersItem {
  markerIds: number[]
  center: {
    latitude: number;
    longitude: number;
  }
  clusterId: number
}
export interface MarkerClusterCreateEvent {
  clusters: ClustersItem[]
}